<?php

namespace App\Models\V1;

use App\Models\V1\Business\GameArea;
use App\Models\V1\Managenment\MerchantGames;
use App\Models\V1\Managenment\MerchantInfo;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Advert extends BaseModel
{
    use HasFactory;
    protected $table="advert";
    protected $fillable=[
        'advert_place_id',
        'title',
        'jump_url',
        'thumb',
        'begin_at',
        'end_at',
        'state'
    ];


    /**
     * 广告位关系
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function AdvertPlace(){
        return $this->belongsTo(AdvertPlace::class,'advert_place_id','id');
    }

    /**
     * 状态
     * @param $key
     * @return string
     */
    public function getStateAttribute($key)
    {
        return (string) $key;
    }
}
